package com.laowang.project.system.controller;

import java.util.List;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.laowang.framework.aspectj.lang.annotation.Log;
import com.laowang.framework.aspectj.lang.enums.BusinessType;

import org.springframework.web.bind.annotation.*;
import com.laowang.project.system.domain.MyCyhActivityVip;
import com.laowang.project.system.service.MyCyhActivityVipService;
import com.laowang.framework.web.controller.BaseController;
import com.laowang.framework.web.domain.AjaxResult;
import com.laowang.common.utils.poi.ExcelUtil;
import com.laowang.framework.web.page.TableDataInfo;

/**
 * 活动vip返佣Controller
 *
 * @author laowang
 * @date 2023-06-07
 */
@Api(tags = "活动vip返佣接口")
@RestController
@RequestMapping("/activityVip")
public class MyCyhActivityVipController extends BaseController {
    @Autowired
    private MyCyhActivityVipService myCyhActivityVipService;

    /**
     * 查询活动vip返佣列表
     */
    @ApiOperation(value = "查询活动vip返佣列表",notes = "")
    @PreAuthorize("@ss.hasPermi('system:activityVip:list')")
    @GetMapping("/list")
    public TableDataInfo list(MyCyhActivityVip myCyhActivityVip) {
        startPage();
        List<MyCyhActivityVip> list = myCyhActivityVipService.selectMyCyhActivityVipList(myCyhActivityVip);
        return getDataTable(list);
    }

    /**
     * 导出活动vip返佣列表
     */
    @ApiOperation(value = "导出活动vip返佣列表",notes = "")
    @PreAuthorize("@ss.hasPermi('system:activityVip:export')")
    @Log(title = "活动vip返佣", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(MyCyhActivityVip myCyhActivityVip) {
        List<MyCyhActivityVip> list = myCyhActivityVipService.selectMyCyhActivityVipList(myCyhActivityVip);
        ExcelUtil<MyCyhActivityVip> util = new ExcelUtil<MyCyhActivityVip>(MyCyhActivityVip.class);
        return util.exportExcel(list, "activityVip");
    }

    /**
     * 获取活动vip返佣详细信息
     */
    @ApiOperation(value = "获取活动vip返佣详细信息",notes = "")
    @PreAuthorize("@ss.hasPermi('system:activityVip:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Integer id) {
        return AjaxResult.success(myCyhActivityVipService.selectMyCyhActivityVipById(id));
    }

    /**
     * 新增活动vip返佣
     */
    @ApiOperation(value = "新增活动vip返佣",notes = "")
    @PreAuthorize("@ss.hasPermi('system:activityVip:add')")
    @Log(title = "活动vip返佣", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody MyCyhActivityVip myCyhActivityVip) {
        return toAjax(myCyhActivityVipService.insertMyCyhActivityVip(myCyhActivityVip));
    }

    /**
     * 修改活动vip返佣
     */
    @ApiOperation(value = "修改活动vip返佣",notes = "")
    @PreAuthorize("@ss.hasPermi('system:activityVip:edit')")
    @Log(title = "活动vip返佣", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody MyCyhActivityVip myCyhActivityVip) {
        return toAjax(myCyhActivityVipService.updateMyCyhActivityVip(myCyhActivityVip));
    }

    /**
     * 删除活动vip返佣
     */
    @ApiOperation(value = "删除活动vip返佣",notes = "")
    @PreAuthorize("@ss.hasPermi('system:activityVip:remove')")
    @Log(title = "活动vip返佣", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Integer[] ids) {
        return toAjax(myCyhActivityVipService.deleteMyCyhActivityVipByIds(ids));
    }
}
